package com.yiban.demo.Util;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class JsonUtil {
    private static final ObjectMapper objectMapper = new ObjectMapper();

    public static String defaultJsonify(Object o) throws JsonProcessingException {
        return objectMapper.writeValueAsString(o);
    }

    public static<T> T defaultDeJsonify(Class<T> type,String json) throws JsonProcessingException {
        return objectMapper.readValue(json, type);
    }
}
